package com.costeaalex.blueserver.pccontrollers;

import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Robot;
import java.awt.event.InputEvent;

import com.costeaalex.blueserver.server.CommandReceiver;

public class MouseController implements CommandReceiver
	{
	
	private Robot r;
	private int id=10;
	
	public MouseController()
		{
		try
			{
			r=new Robot();
			} 
		catch (AWTException e)
			{
 			e.printStackTrace();
			}
		}

	public void parseCommand(byte[] command)
		{
		switch(command[3])
			{
			case 0:
				{
				//0
				break;
				}
			case 1:
				{
				//1
				r.mousePress(InputEvent.BUTTON1_MASK);
				r.mouseRelease(InputEvent.BUTTON1_MASK);
				break;
				}
			case 2:
				{
				//2
				r.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y-5);
				break;
				}
			case 3:
				{
				//3
				break;
				}
			case 4:
				{
				//4
				r.mouseMove(MouseInfo.getPointerInfo().getLocation().x-5, MouseInfo.getPointerInfo().getLocation().y);
				break;
				}
			case 5:
				{
				//5
				break;
				}
			case 6:
				{
				//6
				r.mouseMove(MouseInfo.getPointerInfo().getLocation().x+5, MouseInfo.getPointerInfo().getLocation().y);
				break;
				}
			case 7:
				{
				//7
				break;
				}
			case 8:
				{
				//8
				r.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y+5);
				break;
				}
			case 9:
				{
				//9
				break;
				}
			case 10:
				{
				//*
				break;
				}
			case 11:
				{
				//#
				break;
				}
			}
		}

	public int getReceiverId()
		{
		return id;
		}

	}
